<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Admin extends CIC_A_Controller
{
	function __construct()
	{
		parent::__construct();
	}

	public function index()
	{
		$this->load->view('admin/admin/admin');
	}

	function main()
	{	
		$data['server']		= $this->get_server_info();
		$data['web']		= $this->get_web_info();
		$data['admin']		= $this->session->userdata('admin');
		$this->load->view('admin/admin/main',$data);		
	}

	private function get_web_info()
	{
		return array(
			'SERVER_NAME'		=> $this->input->server('SERVER_NAME'),	
			'SERVER_ADDR'		=> $this->input->server('SERVER_ADDR'),
			'REMOTE_ADDR'		=> $this->input->server('REMOTE_ADDR'),
			'CHARSET'			=> $this->config->item('charset'),
		);
	}

	private function get_server_info()
	{
		return array(
			'SERVER_SOFTWARE'	=> $this->input->server('SERVER_SOFTWARE'),
			'PHP_OS'			=> PHP_OS,
			'PHP_VERSION'		=> PHP_VERSION,
			'MYSQL_VERSION'		=> $this->db->version(),
			'GD_VERSION'		=> $this->get_gd_version(),
			'FILE_UPLOAD'		=> $this->get_file_upload(),
		);
	}
	private function get_gd_version()
	{
		if(function_exists('gd_info'))
		{
			$gd_info	= gd_info();
			$gd_version = $gd_info['GD Version'];
		}else{
			$gd_version = '未知';
		}
		return $gd_version;
	}

	private function get_file_upload()
	{
		if(@ini_get('file_uploads')){
			$umfs = ini_get('upload_max_filesize');
			$pms = ini_get('post_max_size');
   			return '允许 | 文件:'.$umfs.' | 表单：'.$pms;
		}else{
			return '<span class="red_font">禁止</span>';
		}
	}
}